import { createSlice } from '@reduxjs/toolkit'

export const PersonSlice = createSlice({
  name: 'PersonSlice',
  initialState: {
    PersonList:[
        {
            id:1,
            name:'云南白药牙膏官方旗舰店',
            num:45,
            state:false,
        },
        {
            id:2,
            name:'云南白药防蛀洗漱水',
            num:12,
            state:false,
        },
        {
            id:3,
            name:'仿真抱枕',
            num:25,
            state:false,
        },
    ]
  },
  reducers: {
    SwitchPer(state,{payload}){
        const item=state.PersonList.find((state)=>state.id===payload.id)
        item.state=!item.state
    }
  },
})

export const { SwitchPer } = PersonSlice.actions

export default PersonSlice.reducer